import axios from 'axios'
import {Storage} from '../../storage'

const createClass = (form) => axios.post('/api/classes/info', form, {
    headers: {
        "nothing-token" : Storage.get("nothing-token")
    }
}).then(res => res.data)

const getAllClassInfo = (type, havaDelted) => axios.get(`/api/classes/info/list/${type}/${havaDelted}`,{
    headers: {
        "nothing-token" : Storage.get("nothing-token")
    }
}).then(res => res.data)

const getClassInfo = (classId) => axios.get(`/api/classes/info/${classId}`,).then(res => res.data)

const bindClass = (url, stuId) => axios.post('/api/classes/bind/', {url,stuId}).then(res => res.data)

const deleteTheClass = classId => axios.delete(`/api/classes/info/${classId}`).then(res => res.data)

export {
    createClass,
    getAllClassInfo,
    getClassInfo,
    bindClass, deleteTheClass
}